/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef DEVICE_AUTH_DEFINES_H
#define DEVICE_AUTH_DEFINES_H

#define HC_GROUP_FRIEND_MAX_NUM 100 /* Visibility is 1, friend list is available, and max is 100 */
#define HC_GROUP_MANAGER_MAX_NUM 10 /* manager max number is 10, it includes owner and other managers */

enum {
    /* common error code, 0x00000000 ~ 0x00000FFF */
    HC_SUCCESS = 0x00000000,

    HC_ERROR = 0x00000001,
    HC_ERR_INVALID_PARAMS = 0x00000002,
    HC_ERR_INVALID_LEN = 0x00000003,
    HC_ERR_NULL_PTR = 0x00000004,
    HC_ERR_ALLOC_MEMORY = 0x00000005,
    HC_ERR_MEMORY_COPY = 0x00000006,
    HC_HEX_CONVERT_FAILED = 0x00000007,
    HC_ERR_NOT_SUPPORT = 0x00000008,
    HC_ERR_TIME_OUT = 0x00000009,
    HC_ERR_CASE = 0x0000000A,
    HC_ERR_BAD_TIMING = 0x0000000B,
    HC_ERR_PEER_ERROR = 0x0000000C,

    /* error code for huks adapter , 0x00001000 ~ 0x00001FFF */
    HC_ERR_KEY_NOT_EXIST = 0x00001001,
    HC_ERR_GENERATE_KEY_FAILED = 0x000010002,
    HC_ERR_INVALID_PUBLIC_KEY = 0x00001003,
    HC_ERR_VERIFY_FAILED = 0x00001004,
    HC_ERR_HASH_FAIL = 0x00001005,

    /* error code for json util , 0x00002000 ~ 0x00002FFF */
    HC_ERR_JSON_FAIL = 0x00002001,
    HC_ERR_JSON_CREATE = 0x00002002,
    HC_ERR_JSON_GET = 0x00002003,
    HC_ERR_JSON_ADD = 0x00002004,
    HC_ERR_PACKAGE_JSON_TO_STRING_FAIL = 0x00002005,

    /* error code for ipc, 0x00003000 ~ 0x00003FFF */
    HC_ERR_IPC_INTERNAL_FAILED = 0x00003001,
    HC_ERR_IPC_UNKNOW_OPCODE = 0x00003002,
    HC_ERR_IPC_CALL_DATA_LENGTH = 0x00003003,
    HC_ERR_IPC_METHOD_ID_INVALID = 0x00003004,
    HC_ERR_IPC_BAD_MESSAGE_LENGTH = 0x00003005,
    HC_ERR_IPC_BAD_VAL_LENGTH = 0x00003006,
    HC_ERR_IPC_BAD_PARAM_NUM = 0x00003007,
    HC_ERR_IPC_BAD_MSG_TYPE = 0x00003008,
    HC_ERR_IPC_GET_SERVICE = 0x00003009,
    HC_ERR_IPC_GET_PROXY = 0x0000300A,
    HC_ERR_IPC_INIT = 0x0000300B,
    HC_ERR_IPC_BUILD_PARAM = 0x0000300C,
    HC_ERR_IPC_PROC_FAILED = 0x0000300D,
    HC_ERR_IPC_UNKNOW_REPLAY = 0x0000300E,
    HC_ERR_IPC_OUT_DATA_NUM = 0x0000300F,
    HC_ERR_IPC_OUT_DATA = 0x00003010,

    /* error code for module , 0x00004000 ~ 0x00004FFF */
    HC_ERR_MODULE_NOT_FOUNT = 0x00004001,
    HC_ERR_UNSUPPORTED_METHOD = 0x00004002,
    HC_ERR_UNSUPPORTED_VERSION = 0x00004003,
    HC_ERR_UNSUPPORTED_CURVE = 0x00004004,
    HC_ERR_BAD_MESSAGE = 0x00004005,
    HC_ERR_PROOF_NOT_MATCH = 0x00004006,
    HC_ERR_INIT_TASK_FAIL = 0x00004007,
    HC_ERR_TASK_IS_NULL = 0x00004008,
    HC_ERR_TASK_ID_IS_NOT_MATCH = 0x00004009,
    HC_ERR_INVALID_ALG = 0x0000400A,
    HC_ERR_IGNORE_MSG = 0x0000400B,
    HC_ERR_LOCAL_IDENTITY_NOT_EXIST = 0x0000400C,

    /* error code for group , 0x00005000 ~ 0x00005FFF */
    HC_ERR_ACCESS_DENIED = 0x00005001,
    HC_ERR_CALLBACK_NOT_FOUND = 0x00005002,
    HC_ERR_SERVICE_NEED_RESTART = 0x00005003,
    HC_ERR_NO_CANDIDATE_GROUP = 0x00005004,
    HC_ERR_TRANSMIT_FAIL = 0x00005005,
    HC_ERR_REQUEST_EXIST = 0x00005006,
    HC_ERR_REQUEST_NOT_FOUND = 0x00005007,
    HC_ERR_SESSION_NOT_EXIST = 0x00005008,
    HC_ERR_SESSION_ID_CONFLICT = 0x00005009,
    HC_ERR_REQ_REJECTED = 0x0000500A,
    HC_ERR_SERVER_CONFIRM_FAIL = 0x0000500B,
    HC_ERR_CREATE_SESSION_FAIL = 0x0000500C,
    HC_ERR_SESSION_IS_FULL = 0x0000500D,

    /* error code for database , 0x00006000 ~ 0x00006FFF */
    HC_ERR_DB = 0x00006001,
    HC_ERR_BEYOND_LIMIT = 0x00006002,
    HC_ERR_SAVE_DB_FAILED = 0x00006003,
    HC_ERR_FRIEND_NOT_EXIST = 0x00006004,
    HC_ERR_MANAGER_NOT_EXIST = 0x00006005,
    HC_ERR_GROUP_DUPLICATE = 0x00006006,
    HC_ERR_GROUP_NOT_EXIST = 0x00006007,
    HC_ERR_DEVICE_NOT_EXIST = 0x00006008,
    HC_ERR_DEVICE_DUPLICATE = 0x00006009,
    HC_ERR_LOST_DATA = 0x0000600A,

    /* error code for broadcast , 0x00007000 ~ 0x00007FFF */
    HC_ERR_LISTENER_NOT_EXIST = 0x000070012,

    /* error code for channel , 0x00008000 ~ 0x00008FFF */
    HC_ERR_CHANNEL_NOT_EXIST = 0x000080012,
    HC_ERR_SOFT_BUS = 0x00008002,

    /* error code used on DAS service */
    INVALID_PARAMETERS = 0xF0000001,
    EXCEED_AUTHORITY = 0xF0000002,
    TIMEOUT = 0xF0000003,
    NOT_REGISTERED = 0xF0000004,
    NOT_TRUST_PEER = 0xF0000005,
    NOT_TRUST_CONTROLLER = 0xF0000006,
    NOT_TRUST_ACCESSORY = 0xF0000007,
    OVER_MAX_TRUST_NUM = 0xF0000008,
    CONNECTION_INTERRUPTED = 0xF0000009,
    UNSUPPORTED_VERSION = 0xF000000A,
    BAD_PAYLOAD = 0xF000000B,
    ALGORITHM_UNSUPPORTED = 0xF000000C,
    PROOF_MISMATCH = 0xF000000D,
    UNKOWN = 0xF0000000,
};

#endif
